#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;
use LWP::UserAgent;
use JSON;
use 5.10.1;

use evaluation4edu::Admin;

sub enc_json {
	my ( $arg ) = @_;
	eval { JSON->new->utf8->pretty->encode($arg) }
};
sub dec_json {
	my ( $arg ) = @_;
	eval { JSON->new->utf8->pretty->decode($arg) }
};

my $post_req = HTTP::Request->new(POST => 'http://www.morebtcg.org:3000/admin');
$post_req->content(enc_json({
	func => 'get_term',
	arg => {
		term_id => [ qw( 1 2 3 4 5 ) ],
	},
}));

my $ua=LWP::UserAgent->new;
$ua->agent('Test');

my $res=$ua->request($post_req);
if ( $res->is_success ) {
	print $res->content;
}
else {
	say $res->status_line;
}
